package com.sleep.model;

import javax.persistence.*;
import java.util.Date;

/**
 * Created by fadinglan on 2017/4/10.
 */
@Entity
@Table(name = "user_info", schema = "teenagers_monitor", catalog = "")
public class UserInfoEntity {
    private int iUserId;
    private String vcCellphone;
    private String vcPassword;
    private String vcUserName;
    private Byte tiUserSex;
    private Date tUserBirthday;

    @Id
    @Column(name = "i_user_id", nullable = false)
    public int getiUserId() {
        return iUserId;
    }

    public void setiUserId(int iUserId) {
        this.iUserId = iUserId;
    }

    @Basic
    @Column(name = "vc_cellphone", nullable = false, length = 20)
    public String getVcCellphone() {
        return vcCellphone;
    }

    public void setVcCellphone(String vcCellphone) {
        this.vcCellphone = vcCellphone;
    }

    @Basic
    @Column(name = "vc_password", nullable = false, length = 20)
    public String getVcPassword() {
        return vcPassword;
    }

    public void setVcPassword(String vcPassword) {
        this.vcPassword = vcPassword;
    }

    @Basic
    @Column(name = "vc_user_name", nullable = true, length = 20)
    public String getVcUserName() {
        return vcUserName;
    }

    public void setVcUserName(String vcUserName) {
        this.vcUserName = vcUserName;
    }

    @Basic
    @Column(name = "ti_user_sex", nullable = true)
    public Byte getTiUserSex() {
        return tiUserSex;
    }

    public void setTiUserSex(Byte tiUserSex) {
        this.tiUserSex = tiUserSex;
    }

    @Basic
    @Column(name = "t_user_birthday", nullable = true)
    public Date gettUserBirthday() {
        return tUserBirthday;
    }

    public void settUserBirthday(Date tUserBirthday) {
        this.tUserBirthday = tUserBirthday;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        UserInfoEntity that = (UserInfoEntity) o;

        if (iUserId != that.iUserId) return false;
        if (vcCellphone != null ? !vcCellphone.equals(that.vcCellphone) : that.vcCellphone != null) return false;
        if (vcPassword != null ? !vcPassword.equals(that.vcPassword) : that.vcPassword != null) return false;
        if (vcUserName != null ? !vcUserName.equals(that.vcUserName) : that.vcUserName != null) return false;
        if (tiUserSex != null ? !tiUserSex.equals(that.tiUserSex) : that.tiUserSex != null) return false;
        if (tUserBirthday != null ? !tUserBirthday.equals(that.tUserBirthday) : that.tUserBirthday != null)
            return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = iUserId;
        result = 31 * result + (vcCellphone != null ? vcCellphone.hashCode() : 0);
        result = 31 * result + (vcPassword != null ? vcPassword.hashCode() : 0);
        result = 31 * result + (vcUserName != null ? vcUserName.hashCode() : 0);
        result = 31 * result + (tiUserSex != null ? tiUserSex.hashCode() : 0);
        result = 31 * result + (tUserBirthday != null ? tUserBirthday.hashCode() : 0);
        return result;
    }
}
